<template>
	<view class="uni_box home">
		<navbar title='支付记录'>
		</navbar>
		<view class="content">
			<text class="zhitit">支付记录</text>
			<view class="plist">
				<view class="pitem" v-for="(item,index) in list" :key="index">
					<view class="pone">
						<text class="name">{{item.memo}}</text>
						<text class="price">{{item.money}}元</text>
					</view>
					<view class="tview">
						<text class="time">{{item.createtime}}</text>
					</view>
				</view>
			</view>
			<u-loadmore :status="status" @loadmore="loadmore" />
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				page: 1,
				limit: 10,
				last_page: 1,
				status: "loadmore",
			}
		},
		onLoad() {
			this.getList()
		},
		onShow() {
		},
		onReachBottom: function () {
			this.loadmore();
		},
		methods: {
			async getList(){//列表数据
				let res = await this.$u.api.getPayLog({
					page:this.page
				});
			this.last_page = res.lastpage;
			let list = res.list;
			this.list = this.page == 1 ? list : [...this.list, ...list];	
			if(this.page >= this.last_page){
				this.status = 'nomore';
			}
				
			},
			loadmore() {
				let page = this.page;
				if (this.status == 'loadmore') {
					this.page++;
					this.getList();
				}
			},

		}
	}
</script>

<style lang="scss" scoped>
	page{
		background-color: #fff;
	}
	.content{
		min-height: 100vh;
		background-color: #f5f5f5;
		padding: 30rpx;
		padding-bottom: 120rpx;
		.zhitit{
			font-family: PingFang SC;
			font-weight: bold;
			font-size: 36rpx;
			color: #222222;
			display: block;
			margin-bottom: 30rpx;
		}
		.plist{
			display: flex;
			background: #FFFFFF;
			border-radius: 20rpx;
			padding: 10rpx 30rpx;
			flex-direction: column;
			margin-bottom: 30rpx;
			.pitem{
				border-bottom: 1rpx solid #EEEEEE;;
				display: flex;
				flex-direction: column;
				width: 100%;
				padding: 20rpx 0;
				.pone{
					display: flex;
					flex-direction: row;
					align-items: center;
					width: 100%;
					.name{
						font-family: PingFang SC;
						font-weight: 500;
						font-size: 28rpx;
						color: #333333;
					}
					.price{
						margin-left: auto;
						font-family: PingFang SC;
						font-weight: bold;
						font-size: 30rpx;
						color: #F24646;
					}
				}
				.tview{
					display: flex;
					margin-top: 20rpx;
					flex-direction: row;
					.time{
						font-family: PingFang SC;
						font-weight: 500;
						font-size: 22rpx;
						color: #999999;
					}
				}
			}
		}
	}
	
</style>
